<?php
namespace app\controller;
use app\BaseController;
use think\facade\View;

class Tool extends BaseController
{
    public function blue()
    {
        $strBlue = "🇦 🇧 🇨 🇩 🇪 🇫 🇬 🇭 🇮 🇯 🇰 🇱 🇲 🇳 🇴 🇵 🇶 🇷 🇸 🇹 🇺 🇻 🇼 🇽 🇾 🇿 ";
        $haystack = "abcdefghijklmnopqrstuvwxyz";
        $arrayBlue = explode(' ', $strBlue);
        $word = $this->request['word'];
        $result = [];
        if ($word) {
            $len = strlen($word);
            for ($i=0; $i<$len; $i++) {
                $pois = (strpos($haystack, $word{$i}));
                $result[] = $arrayBlue[$pois];
                //dump(strpos($haystack, $word{$i}));
            }

        }
        View::assign('result',$result?implode(' ',$result):'🇦 🇧 🇨 🇩 🇪');
        return View::fetch();
    }

}